package com.silence.gmall.product.domain.repository.impl;

import com.baomidou.mybatisplus.extension.repository.CrudRepository;
import com.silence.gmall.product.assembler.BaseSaleAttrFactory;
import com.silence.gmall.product.domain.entity.BaseSaleAttr;
import com.silence.gmall.product.domain.mapper.BaseSaleAttrMapper;
import com.silence.gmall.product.domain.repository.BaseSaleAttrRepository;
import com.silence.gmall.product.dto.BaseSaleAttrDto;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @Author silence
 * @Description 针对表【base_sale_attr(基本销售属性表)】的数据库操作Repository实现
 * @Date 2025-08-17 16:28:16
 */
@Slf4j
@Repository
@RequiredArgsConstructor
public class BaseSaleAttrRepositoryImpl extends CrudRepository<BaseSaleAttrMapper, BaseSaleAttr>
        implements BaseSaleAttrRepository {
    /**
     * 销售属性工厂
     */
    private final BaseSaleAttrFactory baseSaleAttrFactory;

    /**
     * 获取销售属性
     *
     * @return 销售属性集合
     */
    @Override
    public List<BaseSaleAttrDto> baseSaleAttrList() {
        return baseSaleAttrFactory.baseSaleAttrList2BaseSaleAttrDtoList(list());
    }
}